package com.crazymaker.springcloud.tunnel.remote.client;

import com.crazymaker.push.platform.contract.dto.MsgDTO;
import com.crazymaker.springcloud.common.result.RestOut;
import com.crazymaker.springcloud.standard.config.FeignConfiguration;
import com.crazymaker.springcloud.tunnel.remote.fallback.TunnelClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Feign 客户端接口
 *
 * @description: 用户信息 远程调用接口
 * @date 2019年7月22日
 */

@FeignClient(value = "websocket-provider",
        configuration = FeignConfiguration.class,
//        fallback = UserClientFallback.class,
        fallbackFactory = TunnelClientFallbackFactory.class,
        path = "/websocket-provider/api/other")
public interface TunnelClient {
    /**
     * 远程调用 RPC 方法：
     */
    @RequestMapping(value = "/hello/v1", method = RequestMethod.GET)
    public String hello(@RequestParam(value = "name") String name);


    @RequestMapping(value = "/push/rpc", method = RequestMethod.POST)
    public RestOut<String> pushByRpc(@RequestBody MsgDTO dto);

}
